﻿@model HelloMinasan.Web.Song.ViewModels.SongAdminModel
<div align="center">
    @foreach (var item in Model.ListSong)
    {
        <div class="iconSong">
            <img style="float:left" src="~/Content/Images/song.png" />
            <div align="right" class="titleSong"><i><b>@item.SongName</b></i></div>
            <div align="right">Upload by <b>@item.User.Username</b></div>
            <div align="right" style="color:#c40808">
                @if (item.SongReports.Any())
                {
                    <a href="/Report/SongReport/@item.SongId">
                        <span style="font-weight:bold; cursor:pointer">
                            <img src="/Content/Images/text.png" width="20" />
                            <span>View reports</span>
                        </span>
                    </a>
                }
            </div>
            <div class="controlAdminItems" align="center">
                <a href="/Song/Songs/@item.SongId">
                    <img class="backgroundLinear" src="~/Content/Images/play.png" width="25" />
                </a>
                @if (!item.IsLocked)
                {
                    <img onclick="lockSong(@item.SongId, @Model.PagingControl.CurrentPageNumber, true)" class="backgroundLinear" src="~/Content/Images/admin_icon/lock.png" width="25" />
                }
                else
                {
                    <img onclick="lockSong(@item.SongId, @Model.PagingControl.CurrentPageNumber, false)" class="backgroundLinear" src="~/Content/Images/admin_icon/unlock.png" width="25" />
                }
                <img onclick="deleteSong(@item.SongId, @Model.PagingControl.CurrentPageNumber)" class="backgroundLinear" src="~/Content/Images/Trash_Delete.png" width="25" />
                <a onclick="showLyrics(@item.SongId)">
                    <img class="backgroundLinear" src="~/Content/Images/edit.png" width="25" />
                </a>
            </div>
        </div>
    }
    <div align="left" style="margin-top: 10px;">
    @if (@Model.PagingControl.PreviousPageNumber > 0)
    {
        <a onclick="gotoSongAdminPage(1)" class="buttonClass">First</a>
        <a onclick="gotoSongAdminPage(@Model.PagingControl.PreviousPageNumber)" class="buttonClass">Back</a>
    }
    <select onchange="jumpToPage(this)">
        @for (int i = 1; i <= Model.TotalPageCount; i++)
        {
            if (i != Model.PagingControl.CurrentPageNumber)
            { <option value="@i">@i</option> }
            else
            { <option value="@i" selected>@i</option> }
        }
    </select>
    @if (@Model.PagingControl.NextPageNumber <= Model.TotalPageCount)
    {
        <a onclick="gotoSongAdminPage(@Model.PagingControl.NextPageNumber)" class="buttonClass">Next</a>
        <a onclick="gotoSongAdminPage(@Model.TotalPageCount)" class="buttonClass">Last</a>
    }
</div>
</div>
